package com.whmnx.chitchat.adapter;

import android.content.Context;
import android.provider.SyncStateContract;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.whmnx.chitchat.R;
import com.whmnx.chitchat.bean.GroupBean;
import com.whmnx.chitchat.bean.GroupDatailBean;
import com.whmnx.chitchat.constants.Constants;
import com.whmnx.chitchat.utils.ImageUtil;
import com.whmnx.chitchat.utils.SPUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * author : huang
 * date   : 2020/7/27 0027 17:31
 * version: 1.0
 * @author Administrator
 */
public class GroupMeberAdpter extends CommonRecyclerAdapter<GroupDatailBean.GroupMembersListBean> {
    private Context context;
    private List<Boolean> alreadyLikeList = new ArrayList<>();
    private ImageView view;


    public GroupMeberAdpter(Context context) {
        super(context, R.layout.item_group_user);
        this.context = context;
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, GroupDatailBean.GroupMembersListBean item, int position) {
        helper.setText(R.id.tv_name, (String) item.getUserNick());
       // ImageUtil.setImage(helper.getView(R.id.cv_user),item.getGroup_Img());
        if (item.getUserNick().equals("add")){
            helper.setImageResource(R.id.cv_user,R.mipmap.add3);
            helper.setVisible(R.id.tv_name, View.INVISIBLE);
           /* if (item.getGroupMembers_Type() == 1 && item.getGroupMembers_UserID().equals(SPUtil.getString(Constants.USERID))){
                helper.setImageResource(R.id.cv_user,R.mipmap.add3);
                helper.setVisible(R.id.tv_name, View.INVISIBLE);
            }*/
        }else if (item.getUserNick().equals("del")){
            helper.setImageResource(R.id.cv_user,R.mipmap.cel);
            helper.setVisible(R.id.tv_name, View.INVISIBLE);
        }else {
            ImageUtil.setImage(helper.getView(R.id.cv_user),item.getHeadImg());
            helper.setVisible(R.id.tv_name, View.VISIBLE);
        }
    }
}
